#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <pthread.h>
#define TIME 10000000
int value = 0;
int valueA = 0;
int valueB = 0;

void * add(void* arg){
	while(1){
		valueA++;
		value++;
	}
}

int main(int argc, char ** argv){
	pthread_t tid;

	tid = pthread_create(&tid, NULL, add, (void*)0);
	// main thread
	while(1){
		valueB++;
		value++;

		if(valueB % TIME==0){
			printf("value:%d, valueA:%d, valueB:%d, diff:%d\n", value, valueA, valueB, valueA+valueB-value);
		}
	}

	pthread_join(tid,NULL);
	return 0;
}

